{
    "$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_update_schema.json",
    "title": "JSON Schema for the weekly update of the EMDB archive",
    "description": "This schema contains next week's released, updated and obsoleted entries",
    "version": "1.1",
    "definitions": {
        "updateData": {
            "properties": {
                "total": {"type": "number"},
                "entries": {
                    "type": "array",
                    "items": {
                        "type": "string", 
                        "pattern": "^EMD-[0-9]{4,6}$"
                        }
                    }
            },
            "required": [
                "total",
                "entries"
            ]
        }
    },
    "type": "object",
    "properties": {
        "UpdateDate": {
            "type": "string",
            "format": "date"
        },
        "ReleaseDate": {
            "type": "string",
            "format": "date"
        },
        
        "Releases": {"$ref": "#/definitions/updateData"},
        "Updates": {"$ref": "#/definitions/updateData"},
        "Obsoleted": {"$ref": "#/definitions/updateData"},
        "Withdrawn": {"$ref": "#/definitions/updateData"},
        "NumberOfEntriesWithoutReports" : {"type": "number"},
        "CurrentReleasesValidationReports" : {"$ref": "#/definitions/updateData"},
        "PreviousReleasesValidationReports" : {"$ref": "#/definitions/updateData"}
    },
   "additionalProperties": false,
   "required": ["UpdateDate",
                "ReleaseDate",
                "Releases",
                "Updates",
                "Obsoleted",
                "Withdrawn",
                "NumberOfEntriesWithoutReports",
                "CurrentReleasesValidationReports",
                "PreviousReleasesValidationReports"]
}
