{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://michalie.github.io/catalog.schema.json",
  "title": "AI for Science catalog schema",
  "type": "object",
  "additionalProperties": false,
  "required": ["id", "title", "description", "version", "date_modified", "language", "access_rights", "rights", "license", "code_license", "repository", "release_ref", "creator", "publisher", "dedication", "catalogs", "related_resources"],
  "properties": {
    "$schema": {"type": "string"},
    "id": {"type": "string", "format": "uri"},
    "title": {"type": "string", "minLength": 1},
    "description": {"type": "string", "minLength": 1},
    "version": {"type": "string", "minLength": 1},
    "date_modified": {"type": "string", "format": "date"},
    "language": {"type": "string", "pattern": "^[a-z]{2}$"},
    "access_rights": {"const": "public"},
    "rights": {"type": "string", "minLength": 1},
    "license": {"type": "string", "format": "uri"},
    "code_license": {"type": "string", "format": "uri"},
    "repository": {"type": "string", "format": "uri"},
    "release_ref": {
      "anyOf": [
        {"type": "string", "format": "uri"},
        {"type": "null"}
      ]
    },
    "creator": {
      "type": "object",
      "additionalProperties": false,
      "required": ["name", "email", "url", "affiliation"],
      "properties": {
        "name": {"type": "string", "minLength": 1},
        "email": {"type": "string", "format": "email"},
        "url": {"type": "string", "format": "uri"},
        "affiliation": {
          "type": "object",
          "additionalProperties": false,
          "required": ["name", "url"],
          "properties": {
            "name": {"type": "string", "minLength": 1},
            "url": {"type": "string", "format": "uri"}
          }
        }
      }
    },
    "publisher": {
      "type": "object",
      "additionalProperties": false,
      "required": ["type", "name", "email", "url", "affiliation"],
      "properties": {
        "type": {"const": "Person"},
        "name": {"type": "string", "minLength": 1},
        "email": {"type": "string", "format": "email"},
        "url": {"type": "string", "format": "uri"},
        "affiliation": {
          "type": "object",
          "additionalProperties": false,
          "required": ["name", "url"],
          "properties": {
            "name": {"type": "string", "minLength": 1},
            "url": {"type": "string", "format": "uri"}
          }
        }
      }
    },
    "dedication": {
      "type": "object",
      "additionalProperties": false,
      "required": ["name", "url", "description"],
      "properties": {
        "name": {"type": "string", "minLength": 1},
        "url": {"type": "string", "format": "uri"},
        "description": {"type": "string", "minLength": 1}
      }
    },
    "catalogs": {
      "type": "array",
      "minItems": 3,
      "maxItems": 3,
      "items": {
        "type": "object",
        "additionalProperties": false,
          "required": ["id", "title", "version", "record_count", "record_type", "landing_page", "data_distribution", "schema", "metadata", "description"],
        "properties": {
          "id": {"type": "string", "format": "uri"},
            "title": {"type": "string", "minLength": 1},
            "version": {"type": "string", "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$"},
            "record_count": {"type": "integer", "minimum": 1},
          "record_type": {"type": "string", "minLength": 1},
          "landing_page": {"type": "string", "format": "uri"},
          "data_distribution": {"type": "string", "format": "uri"},
          "schema": {"type": "string", "format": "uri"},
          "metadata": {"type": "string", "format": "uri"},
          "description": {"type": "string", "minLength": 1}
        }
      }
    },
    "related_resources": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["id", "title", "relationship", "description", "landing_page", "community", "included_in_child_catalog", "verified", "access_note"],
        "properties": {
          "id": {"type": "string", "format": "uri"},
          "title": {"type": "string", "minLength": 1},
          "relationship": {"type": "string", "minLength": 1},
          "description": {"type": "string", "minLength": 1},
          "landing_page": {"type": "string", "format": "uri"},
          "source_repository": {"type": "string", "format": "uri"},
          "community": {"type": "string", "minLength": 1},
          "included_in_child_catalog": {"const": false},
          "verified": {"type": "string", "format": "date"},
          "access_note": {"type": "string", "minLength": 1}
        }
      }
    }
  }
}
