{
    "$comment": "At the time draft 7 of JSON schema was the latest version and the explict reference to this version is chosen",
    "$schema": "http://json-schema.org/draft-07/schema#",
    "$id": "https://github.com/emdb-empiar/emdb-json-schemas/emdb_released_holdings_schema.json",
    "title": "JSON Schema for the weekly provision of a list of files in every entry from the EMDB archive",
    "description": "This schema contains the list of files for every EMDB entry",
    "definitions": {
        "holdings": {
            "properties": {
                "entry_last_update": {"type": "string", "format": "date"},
                "headers": {"allOf": [{"$ref": "#/definitions/files"},{"minItems": 1,"maxItems": 3}]},
                "map": {"allOf": [{"$ref": "#/definitions/files"},{"minItems": 1,"maxItems": 1}]},
                "half_maps": {"anyOf": [
                    {"allOf": [{"$ref": "#/definitions/files"},{"maxItems": 0}]},
                    {"allOf": [{"$ref": "#/definitions/files"},{"maxItems": 2}]}
                ]},
                "additional_maps": {"$ref": "#/definitions/files"},
                "masks": {"$ref": "#/definitions/files"},
                "fscs": {"$ref": "#/definitions/files"},
                "figure": {"$ref": "#/definitions/files"},
                "structure_factors": {"$ref": "#/definitions/files"},
                "layer_lines": {"$ref": "#/definitions/files"},
                "validation_reports_last_update": {"type": "string", "format": "date"},
                "validation_reports": {"$ref": "#/definitions/files"},
                "unknown": {"$ref": "#/definitions/files"}
            },
            "required": [
                "entry_last_update",
                "headers"
            ]
        },
        "files": {
            "type": "array",
            "items": {"type": "object"},
            "properties": {
                "last_update": {"type": "string", "format": "date"},
                "file_name": {"type": "string"},
                "md5_checksum": {"type": "string"}
            },
            "required": ["last_update", "file_name", "md5_checksum"]
        }
    },
    "type": "object",
    "minProperties": 1,
    "patternProperties": {
        "^EMD-[0-9]{4,6}$": {"$ref": "#/definitions/holdings"}
    },
    "additionalProperties": false
}
