{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "https://schema.entrecode.de/schema-data/dm-asset",
  "type": "object",
  "properties": {
    "assetID": {
      "$ref": "https://schema.entrecode.de/schema-data/uuidB64"
    },
    "title": {
      "type": "string"
    },
    "caption": {
      "type": "string"
    },
    "type": {
      "type": "string",
      "enum": ["image", "video", "audio", "plain", "document", "spreadsheet", "archive", "other"]
    },
    "mimetype": {
      "type": "string",
      "pattern": "^(image|video|audio|text|application)/[a-z0-9\\.+-]+$"
    },
    "created": {
      "type": "string",
      "format": "date-time"
    },
    "modified": {
      "oneOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    },
    "creator": {
      "oneOf": [
        {
          "$ref": "https://schema.entrecode.de/schema-data/uuidV4"
        },
        {
          "type": "null"
        }
      ]
    },
    "creatorType": {
      "type": "string",
      "enum": ["ecUser", "dmUser", "public"]
    },
    "tags": {
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^[A-Za-z0-9äüöß_\\-:]+$"
      }
    },
    "file": {
      "type": "object",
      "properties": {
        "url": {
          "type": "string",
          "format": "uri"
        },
        "size": {
          "type": "number",
          "multipleOf": 1.0,
          "minimum": 0
        },
        "resolution": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "width": {
                  "type": "number",
                  "multipleOf": 1.0,
                  "minimum": 1
                },
                "height": {
                  "type": "number",
                  "multipleOf": 1.0,
                  "minimum": 1
                }
              },
              "additionalProperties": false,
              "required": ["width", "height"]
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "additionalProperties": false,
      "required": ["url", "size"]
    },
    "fileVariants": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "size": {
            "type": "number",
            "multipleOf": 1.0,
            "minimum": 0
          },
          "resolution": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "width": {
                    "type": "number",
                    "multipleOf": 1.0,
                    "minimum": 1
                  },
                  "height": {
                    "type": "number",
                    "multipleOf": 1.0,
                    "minimum": 1
                  }
                },
                "additionalProperties": false,
                "required": ["width", "height"]
              },
              {
                "type": "null"
              }
            ]
          },
          "mimetype": {
            "type": "string",
            "pattern": "^(image|video|audio|text|application)\/[a-z0-9\\.+-]+$"
          }
        },
        "additionalProperties": false,
        "required": ["url", "size", "resolution"]
      }
    },
    "thumbnails": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "dimension": {
            "type": "number",
            "multipleOf": 1.0,
            "minimum": 1
          }
        },
        "additionalProperties": false,
        "required": ["url", "dimension"]
      }
    },
    "isUsed": {
      "type": "boolean"
    },
    "isIncomplete": {
      "type": "boolean"
    },
    "duplicates": {
      "type": "integer",
      "min": 0
    },
    "_links": {
      "allOf": [
        {
          "$ref": "https://schema.entrecode.de/schema-data/hal#/definitions/baseResource/properties/_links"
        },
        {
          "required": ["self"]
        }
      ]
    }
  }
}
