{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://noema-lab.dev/schemas/image_dataset_manifest.schema.json",
  "title": "Noema manifest-backed image dataset",
  "type": "object",
  "required": [
    "schema_version",
    "kind",
    "id",
    "version",
    "root",
    "splits",
    "samples"
  ],
  "properties": {
    "schema_version": {"const": 1},
    "kind": {"const": "noema.image_dataset_manifest"},
    "id": {"type": "string", "minLength": 1},
    "version": {"type": ["string", "integer"]},
    "root": {"type": "string", "minLength": 1},
    "source_page": {"type": "string"},
    "license": {"type": "object"},
    "publication_ready": {"type": "boolean"},
    "publication_blocker": {"type": "string"},
    "splits": {
      "type": "object",
      "minProperties": 1,
      "additionalProperties": {
        "type": "array",
        "minItems": 1,
        "uniqueItems": true,
        "items": {"type": "string", "minLength": 1}
      }
    },
    "samples": {
      "type": "array",
      "minItems": 1,
      "items": {"$ref": "#/$defs/sample"}
    }
  },
  "additionalProperties": false,
  "$defs": {
    "sha256": {
      "type": "string",
      "pattern": "^[0-9a-f]{64}$"
    },
    "sample": {
      "type": "object",
      "required": [
        "sample_id",
        "path",
        "sha256",
        "source_id",
        "group_id",
        "source_sha256",
        "ancestry_ids",
        "transform",
        "transform_fingerprint_sha256"
      ],
      "properties": {
        "sample_id": {"type": "string", "minLength": 1},
        "path": {"type": "string", "minLength": 1},
        "sha256": {"$ref": "#/$defs/sha256"},
        "source_id": {"type": "string", "minLength": 1},
        "group_id": {"type": "string", "minLength": 1},
        "source_sha256": {"$ref": "#/$defs/sha256"},
        "ancestry_ids": {
          "type": "array",
          "minItems": 1,
          "uniqueItems": true,
          "items": {"type": "string", "minLength": 1}
        },
        "transform": {
          "type": "object",
          "required": ["name"],
          "properties": {"name": {"type": "string", "minLength": 1}},
          "additionalProperties": true
        },
        "transform_fingerprint_sha256": {"$ref": "#/$defs/sha256"},
        "post_transform_sha256": {"$ref": "#/$defs/sha256"}
      },
      "additionalProperties": false
    }
  }
}
