{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Italian tourism archive registry",
  "type": "object",
  "required": [
    "schemaVersion",
    "registryType",
    "status",
    "country",
    "routingKey",
    "supportedCategories",
    "capacity",
    "archives",
    "territories",
    "aliases",
    "catalogRecordCountAcrossRegisteredTerritories"
  ],
  "properties": {
    "schemaVersion": {
      "const": 2
    },
    "status": {
      "enum": [
        "LOCAL_DRAFT_NOT_PUBLISHED",
        "PUBLISHED"
      ]
    },
    "country": {
      "const": "IT"
    },
    "supportedCategories": {
      "type": "array",
      "uniqueItems": true,
      "items": {
        "enum": [
          "musei",
          "monumenti",
          "punti_interesse",
          "luoghi_culto"
        ]
      }
    },
    "capacity": {
      "type": "object",
      "required": [
        "maxProjectsPerAccount",
        "projectsRegisteredInThisRegistry",
        "accountWideRemainingSlots"
      ],
      "properties": {
        "maxProjectsPerAccount": {
          "const": 100
        },
        "projectsRegisteredInThisRegistry": {
          "type": "integer",
          "minimum": 0,
          "maximum": 100
        },
        "plannedIndexProjectCountedInAccount": {
          "const": 1
        },
        "projectsInThisSystemIfIndexIsPublished": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100
        },
        "theoreticalAdditionalProjectsUnderCapForThisSystemOnly": {
          "type": "integer",
          "minimum": 0,
          "maximum": 99
        }
      }
    },
    "archives": {
      "type": "array",
      "maxItems": 100,
      "items": {
        "type": "object",
        "required": [
          "archiveId",
          "baseUrl",
          "territoryIndexUrl",
          "territoryCount",
          "categoryIds",
          "recordCount"
        ]
      }
    },
    "territories": {
      "type": "object",
      "additionalProperties": {
        "type": "object",
        "required": [
          "territoryId",
          "entityType",
          "country",
          "name",
          "identifiers",
          "sourceTerritoryIds",
          "categories"
        ],
        "properties": {
          "territoryId": {
            "type": "string"
          },
          "entityType": {
            "enum": [
              "region",
              "province",
              "municipality",
              "statistical_locality",
              "settlement",
              "hamlet",
              "borough"
            ]
          },
          "identifiers": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "namespace",
                "value",
                "sourceUrl"
              ]
            }
          },
          "categories": {
            "type": "object",
            "additionalProperties": {
              "type": "object",
              "required": [
                "categoryId",
                "archiveId",
                "catalogPath",
                "catalogUrl",
                "assetBaseUrl",
                "recordCount"
              ]
            }
          }
        }
      }
    },
    "aliases": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    },
    "catalogRecordCountAcrossRegisteredTerritories": {
      "type": "integer",
      "minimum": 0
    },
    "publication": {
      "type": "object",
      "required": [
        "siteUrl",
        "registryUrl",
        "verifiedAtUtc",
        "onlineHttpStatus",
        "verifiedArchives"
      ],
      "properties": {
        "siteUrl": {
          "type": "string",
          "format": "uri"
        },
        "registryUrl": {
          "type": "string",
          "format": "uri"
        },
        "verifiedAtUtc": {
          "type": "string",
          "format": "date-time"
        },
        "onlineHttpStatus": {
          "const": 200
        },
        "verifiedArchives": {
          "type": "array",
          "minItems": 2,
          "items": {
            "type": "object",
            "required": [
              "territoryId",
              "catalogUrl",
              "httpStatus",
              "recordCount"
            ],
            "properties": {
              "territoryId": {
                "type": "string"
              },
              "catalogUrl": {
                "type": "string",
                "format": "uri"
              },
              "httpStatus": {
                "const": 200
              },
              "recordCount": {
                "type": "integer",
                "minimum": 0
              }
            }
          }
        }
      }
    }
  }
}
