{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://valeria.gallery/schemas/vmc/3.0/schema.json",
  "title": "Valeria Metadata Compiled 3.0",
  "description": "The compiled, per-asset Valeria metadata document embedded as a JSON-LD C2PA assertion.",
  "type": "object",
  "required": ["@context", "@type", "schema", "asset", "metadata"],
  "properties": {
    "@context": {
      "const": "https://valeria.gallery/contexts/vmc/3.0/context.json"
    },
    "@type": {
      "const": "ValeriaMetadataCompiled"
    },
    "schema": {
      "const": "https://valeria.gallery/schemas/vmc/3.0/schema.json"
    },
    "asset": {
      "type": "object",
      "required": ["identifier", "filename", "path", "media_type"],
      "properties": {
        "identifier": {"type": "string", "format": "uri"},
        "filename": {"type": "string", "minLength": 1},
        "path": {"type": "string", "minLength": 1},
        "media_type": {"type": "string", "minLength": 1}
      },
      "additionalProperties": true
    },
    "metadata": {
      "type": "object",
      "properties": {
        "gallery": {"$ref": "#/$defs/namedEntity"},
        "collection": {"$ref": "#/$defs/namedEntity"},
        "image": {
          "type": "object",
          "properties": {
            "title": {"type": "string"},
            "curation_level": {
              "enum": ["curated", "extended", "complete"]
            }
          },
          "additionalProperties": true
        },
        "creator": {"$ref": "#/$defs/party"},
        "rights": {
          "type": "object",
          "properties": {
            "copyright_notice": {"type": "string"},
            "rights_holder": {"$ref": "#/$defs/party"},
            "license": {"$ref": "#/$defs/controlledTerm"},
            "rights_statement": {"$ref": "#/$defs/controlledTerm"}
          },
          "additionalProperties": true
        },
        "source": {
          "type": "object",
          "properties": {
            "digital_source_type": {"$ref": "#/$defs/controlledTerm"}
          },
          "additionalProperties": true
        }
      },
      "additionalProperties": true
    }
  },
  "$defs": {
    "namedEntity": {
      "type": "object",
      "properties": {"title": {"type": "string"}},
      "additionalProperties": true
    },
    "party": {
      "type": "object",
      "properties": {
        "name": {"type": "string"},
        "organization": {"type": "string"},
        "identifier": {"type": "string", "format": "uri"}
      },
      "additionalProperties": true
    },
    "controlledTerm": {
      "type": "object",
      "properties": {
        "identifier": {"type": "string"},
        "name": {"type": "string"},
        "label": {"type": "string"},
        "uri": {"type": "string", "format": "uri"}
      },
      "required": ["uri"],
      "additionalProperties": true
    }
  },
  "additionalProperties": true
}
