{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://chris-page-gov.github.io/okf-explorer/profile/context-archive/v1/registry.schema.json",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "schema": {
      "const": "okf-context-archive-registry.v1"
    },
    "cases": {
      "type": "array",
      "minItems": 1,
      "maxItems": 20,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9-]{0,63}$"
          },
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2048
          },
          "package": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "path": {
                "type": "string",
                "minLength": 1,
                "maxLength": 512
              },
              "bytes": {
                "type": "integer",
                "minimum": 1,
                "maximum": 1048576
              },
              "sha256": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "encoding": {
                "enum": [
                  "json",
                  "gzip"
                ]
              },
              "canonical_bytes": {
                "type": "integer",
                "minimum": 1,
                "maximum": 524288
              },
              "canonical_sha256": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              }
            },
            "required": [
              "path",
              "bytes",
              "sha256",
              "encoding",
              "canonical_bytes",
              "canonical_sha256"
            ]
          },
          "receipt": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "path": {
                "type": "string",
                "minLength": 1,
                "maxLength": 512
              },
              "bytes": {
                "type": "integer",
                "minimum": 1,
                "maximum": 2097152
              },
              "sha256": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              }
            },
            "required": [
              "path",
              "bytes",
              "sha256"
            ]
          },
          "question_sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "source_version": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2048
          },
          "engine_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              }
            ]
          },
          "original_engine_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              }
            ]
          },
          "observation_kind": {
            "enum": [
              "local",
              "public",
              "synthetic"
            ]
          },
          "approved_publication": {
            "const": true
          },
          "publication_note": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2048
          }
        },
        "required": [
          "id",
          "title",
          "package",
          "receipt",
          "question_sha256",
          "source_version",
          "engine_id",
          "original_engine_id",
          "observation_kind",
          "approved_publication",
          "publication_note"
        ]
      }
    }
  },
  "required": [
    "schema",
    "cases"
  ]
}
