{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://aptatlas.org/data/manifest.schema.json",
  "title": "APT data manifest",
  "description": "Every file in this release, with its schema, size and SHA-256.",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "schema": {
      "type": "string"
    },
    "name": {
      "const": "manifest"
    },
    "version": {
      "type": "string",
      "pattern": "^\\d+\\.\\d+$"
    },
    "last_updated": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "licence": {
      "const": "CC-BY-4.0"
    },
    "licence_url": {
      "type": "string"
    },
    "citation": {
      "type": "string"
    },
    "archive_doi": {
      "type": "string"
    },
    "files": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "file",
          "format",
          "title",
          "description",
          "url",
          "latest_url",
          "schema_url",
          "licence",
          "third_party",
          "bytes",
          "sha256"
        ],
        "properties": {
          "file": {
            "type": "string"
          },
          "format": {
            "enum": [
              "json",
              "csv"
            ]
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "latest_url": {
            "type": "string"
          },
          "schema_url": {
            "type": "string"
          },
          "licence": {
            "type": "string"
          },
          "third_party": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "name",
                "licence",
                "relationship"
              ],
              "additionalProperties": false,
              "properties": {
                "name": {
                  "type": "string"
                },
                "licence": {
                  "type": "string"
                },
                "relationship": {
                  "enum": [
                    "source",
                    "derived"
                  ]
                }
              }
            }
          },
          "bytes": {
            "type": "integer"
          },
          "sha256": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          }
        }
      }
    }
  },
  "required": [
    "schema",
    "name",
    "version",
    "last_updated",
    "licence",
    "licence_url",
    "citation",
    "archive_doi",
    "files"
  ]
}
