{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Occupy Antarctica read contract",
  "type": "object",
  "required": [
    "schema_version",
    "release_id",
    "generated_at",
    "generation_is_not_source_review",
    "counts",
    "records",
    "sources",
    "relations"
  ],
  "properties": {
    "schema_version": {
      "const": "1.1.0"
    },
    "release_id": {
      "type": "string"
    },
    "generated_at": {
      "type": "string",
      "format": "date-time"
    },
    "generation_is_not_source_review": {
      "const": true
    },
    "counts": {
      "type": "object",
      "required": [
        "historical",
        "theory",
        "video"
      ],
      "additionalProperties": {
        "type": "integer",
        "minimum": 0
      }
    },
    "records": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/record"
      }
    },
    "sources": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "id",
          "url",
          "last_http_checked_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^source:[a-f0-9]{20}$"
          },
          "url": {
            "type": "string",
            "pattern": "^https?://"
          },
          "last_http_checked_at": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      }
    },
    "relations": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "id",
          "from_id",
          "to_id",
          "predicate",
          "why",
          "is_corroboration"
        ],
        "properties": {
          "predicate": {
            "const": "related_context"
          },
          "why": {
            "type": "string",
            "minLength": 1
          },
          "is_corroboration": {
            "const": false
          }
        }
      }
    }
  },
  "$defs": {
    "record": {
      "type": "object",
      "required": [
        "id",
        "legacy_id",
        "kind",
        "title",
        "url",
        "summary",
        "assessment",
        "sources",
        "visual",
        "dates",
        "provenance",
        "record_sha256"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^(history|theory|video):[A-Za-z0-9_-]+$"
        },
        "kind": {
          "enum": [
            "historical",
            "theory",
            "video"
          ]
        },
        "title": {
          "type": "string",
          "minLength": 1
        },
        "url": {
          "type": "string"
        },
        "assessment": {
          "type": "object",
          "required": [
            "label",
            "scope"
          ],
          "properties": {
            "label": {
              "enum": [
                "record",
                "disputed",
                "unverified",
                "speculative",
                "context",
                "unreviewed_video"
              ]
            },
            "scope": {
              "type": "string",
              "minLength": 1
            }
          }
        },
        "sources": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "object",
            "required": [
              "source_id",
              "role",
              "supports_claim_truth"
            ],
            "properties": {
              "source_id": {
                "type": "string"
              },
              "role": {
                "type": "string"
              },
              "supports_claim_truth": {
                "type": "null"
              }
            }
          }
        },
        "dates": {
          "type": "object",
          "required": [
            "editorial_review_date_reported",
            "content_modified_at",
            "source_rechecked_at"
          ]
        },
        "provenance": {
          "type": "object",
          "required": [
            "input",
            "input_key",
            "input_record_sha256",
            "original_fields"
          ]
        },
        "record_sha256": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        },
        "display_title": {
          "type": "string",
          "description": "Editorial English subject label; archival title remains in title."
        },
        "display_subtitle": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    }
  }
}
