{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.michaeldariuseastwood.com/schemas/entity-authority.schema.json",
  "title": "Canonical public entity authority",
  "type": "object",
  "additionalProperties": false,
  "required": ["schemaVersion", "authorityId", "dateModified", "person", "website", "programme"],
  "properties": {
    "schemaVersion": {"const": 1},
    "authorityId": {"type": "string", "minLength": 1},
    "dateModified": {"type": "string", "format": "date"},
    "person": {"$ref": "#/$defs/person"},
    "website": {"$ref": "#/$defs/website"},
    "programme": {"$ref": "#/$defs/programme"}
  },
  "$defs": {
    "stringArray": {"type": "array", "minItems": 1, "uniqueItems": true, "items": {"type": "string", "minLength": 1}},
    "identifier": {
      "type": "object",
      "additionalProperties": false,
      "required": ["propertyID", "value"],
      "properties": {
        "propertyID": {"type": "string", "minLength": 1},
        "value": {"type": "string", "minLength": 1}
      }
    },
    "person": {
      "type": "object",
      "additionalProperties": false,
      "required": ["id", "profilePageId", "name", "givenName", "additionalName", "familyName", "alternateName", "url", "profileUrl", "image", "description", "jobTitle", "sameAs", "identifiers", "knowsAbout"],
      "properties": {
        "id": {"type": "string", "format": "uri"},
        "profilePageId": {"type": "string", "format": "uri"},
        "name": {"type": "string", "minLength": 1},
        "givenName": {"type": "string", "minLength": 1},
        "additionalName": {"type": "string", "minLength": 1},
        "familyName": {"type": "string", "minLength": 1},
        "alternateName": {"$ref": "#/$defs/stringArray"},
        "url": {"type": "string", "format": "uri"},
        "profileUrl": {"type": "string", "format": "uri"},
        "image": {"type": "string", "format": "uri"},
        "description": {"type": "string", "minLength": 1},
        "jobTitle": {"$ref": "#/$defs/stringArray"},
        "sameAs": {"$ref": "#/$defs/stringArray"},
        "identifiers": {"type": "array", "minItems": 1, "items": {"$ref": "#/$defs/identifier"}},
        "knowsAbout": {"$ref": "#/$defs/stringArray"}
      }
    },
    "website": {
      "type": "object",
      "additionalProperties": false,
      "required": ["id", "url", "name", "language"],
      "properties": {
        "id": {"type": "string", "format": "uri"},
        "url": {"type": "string", "format": "uri"},
        "name": {"type": "string", "minLength": 1},
        "language": {"type": "string", "minLength": 1}
      }
    },
    "programme": {
      "type": "object",
      "additionalProperties": false,
      "required": ["id", "url", "name", "description", "doi", "doiUrl", "osfUrl", "license"],
      "properties": {
        "id": {"type": "string", "format": "uri"},
        "url": {"type": "string", "format": "uri"},
        "name": {"type": "string", "minLength": 1},
        "description": {"type": "string", "minLength": 1},
        "doi": {"type": "string", "pattern": "^10\\."},
        "doiUrl": {"type": "string", "format": "uri"},
        "osfUrl": {"type": "string", "format": "uri"},
        "license": {"type": "string", "format": "uri"}
      }
    }
  }
}
