{
  "$comment": "Schema version 1.3.0",
  "$defs": {
    "certificate_id": {
      "description": "Certificate Identifier, format as per UVCI: Annex 2 in  https://ec.europa.eu/health/sites/health/files/ehealth/docs/vaccination-proof_interoperability-guidelines_en.pdf",
      "maxLength": 80,
      "type": "string"
    },
    "country_vt": {
      "description": "Country of Vaccination / Test, ISO 3166 alpha-2 where possible",
      "pattern": "[A-Z]{1,10}",
      "type": "string",
      "valueset-uri": "valuesets/country-2-codes.json"
    },
    "disease-agent-targeted": {
      "description": "EU eHealthNetwork: Value Sets for Digital Covid Certificates. version 1.0, 2021-04-16, section 2.1",
      "type": "string",
      "valueset-uri": "valuesets/disease-agent-targeted.json"
    },
    "dose_posint": {
      "description": "Dose Number / Total doses in Series: positive integer",
      "minimum": 1,
      "type": "integer"
    },
    "issuer": {
      "description": "Certificate Issuer",
      "maxLength": 80,
      "type": "string"
    },
    "person_name": {
      "description": "Person name: Surname(s), forename(s) - in that order",
      "properties": {
        "fn": {
          "description": "The surname or primary name(s) of the person addressed in the certificate",
          "examples": [
            "d'\u010cervenkov\u00e1 Panklov\u00e1"
          ],
          "maxLength": 80,
          "title": "Surname",
          "type": "string"
        },
        "fnt": {
          "description": "The surname(s) of the person, transliterated ICAO 9303",
          "examples": [
            "DCERVENKOVA<PANKLOVA"
          ],
          "maxLength": 80,
          "pattern": "^[A-Z<]*$",
          "title": "Standardised surname",
          "type": "string"
        },
        "gn": {
          "description": "The forename(s) of the person addressed in the certificate",
          "examples": [
            "Ji\u0159ina-Maria Alena"
          ],
          "maxLength": 80,
          "title": "Forename",
          "type": "string"
        },
        "gnt": {
          "description": "The forename(s) of the person, transliterated ICAO 9303",
          "examples": [
            "JIRINA<MARIA<ALENA"
          ],
          "maxLength": 80,
          "pattern": "^[A-Z<]*$",
          "title": "Standardised forename",
          "type": "string"
        }
      },
      "required": [
        "fnt"
      ],
      "type": "object"
    },
    "recovery_entry": {
      "description": "Recovery Entry",
      "properties": {
        "ci": {
          "$ref": "#/$defs/certificate_id",
          "description": "Unique Certificate Identifier, UVCI"
        },
        "co": {
          "$ref": "#/$defs/country_vt",
          "description": "Country of Test"
        },
        "df": {
          "description": "ISO 8601 complete date: Certificate Valid From",
          "format": "date",
          "type": "string"
        },
        "du": {
          "description": "ISO 8601 complete date: Certificate Valid Until",
          "format": "date",
          "type": "string"
        },
        "fr": {
          "description": "ISO 8601 complete date of first positive NAA test result",
          "format": "date",
          "type": "string"
        },
        "is": {
          "$ref": "#/$defs/issuer",
          "description": "Certificate Issuer"
        },
        "tg": {
          "$ref": "#/$defs/disease-agent-targeted"
        }
      },
      "required": [
        "tg",
        "fr",
        "co",
        "is",
        "df",
        "du",
        "ci"
      ],
      "type": "object"
    },
    "test-manf": {
      "description": "EU eHealthNetwork: Value Sets for Digital Covid Certificates. version 1.0, 2021-04-16, section 2.8",
      "type": "string",
      "valueset-uri": "valuesets/test-manf.json"
    },
    "test-result": {
      "description": "EU eHealthNetwork: Value Sets for Digital Covid Certificates. version 1.0, 2021-04-16, section 2.9",
      "type": "string",
      "valueset-uri": "valuesets/test-result.json"
    },
    "test-type": {
      "description": "EU eHealthNetwork: Value Sets for Digital Covid Certificates. version 1.0, 2021-04-16, section 2.7",
      "type": "string",
      "valueset-uri": "valuesets/test-type.json"
    },
    "test_entry": {
      "description": "Test Entry",
      "properties": {
        "ci": {
          "$ref": "#/$defs/certificate_id",
          "description": "Unique Certificate Identifier, UVCI"
        },
        "co": {
          "$ref": "#/$defs/country_vt",
          "description": "Country of Test"
        },
        "is": {
          "$ref": "#/$defs/issuer",
          "description": "Certificate Issuer"
        },
        "ma": {
          "$ref": "#/$defs/test-manf",
          "description": "RAT Test name and manufacturer"
        },
        "nm": {
          "description": "NAA Test Name",
          "maxLength": 80,
          "type": "string"
        },
        "sc": {
          "description": "Date/Time of Sample Collection",
          "format": "date-time",
          "type": "string"
        },
        "tc": {
          "description": "Testing Centre",
          "maxLength": 80,
          "type": "string"
        },
        "tg": {
          "$ref": "#/$defs/disease-agent-targeted"
        },
        "tr": {
          "$ref": "#/$defs/test-result",
          "description": "Test Result"
        },
        "tt": {
          "$ref": "#/$defs/test-type",
          "description": "Type of Test"
        }
      },
      "required": [
        "tg",
        "tt",
        "sc",
        "tr",
        "co",
        "is",
        "ci"
      ],
      "type": "object"
    },
    "vaccination_entry": {
      "description": "Vaccination Entry",
      "properties": {
        "ci": {
          "$ref": "#/$defs/certificate_id",
          "description": "Unique Certificate Identifier: UVCI"
        },
        "co": {
          "$ref": "#/$defs/country_vt",
          "description": "Country of Vaccination"
        },
        "dn": {
          "$ref": "#/$defs/dose_posint",
          "description": "Dose Number"
        },
        "dt": {
          "description": "ISO8601 complete date: Date of Vaccination",
          "format": "date",
          "type": "string"
        },
        "is": {
          "$ref": "#/$defs/issuer",
          "description": "Certificate Issuer"
        },
        "ma": {
          "$ref": "#/$defs/vaccine-mah-manf",
          "description": "Marketing Authorization Holder - if no MAH present, then manufacturer"
        },
        "mp": {
          "$ref": "#/$defs/vaccine-medicinal-product",
          "description": "vaccine medicinal product"
        },
        "sd": {
          "$ref": "#/$defs/dose_posint",
          "description": "Total Series of Doses"
        },
        "tg": {
          "$ref": "#/$defs/disease-agent-targeted",
          "description": "disease or agent targeted"
        },
        "vp": {
          "$ref": "#/$defs/vaccine-prophylaxis",
          "description": "vaccine or prophylaxis"
        }
      },
      "required": [
        "tg",
        "vp",
        "mp",
        "ma",
        "dn",
        "sd",
        "dt",
        "co",
        "is",
        "ci"
      ],
      "type": "object"
    },
    "vaccine-mah-manf": {
      "description": "EU eHealthNetwork: Value Sets for Digital Covid Certificates. version 1.0, 2021-04-16, section 2.4",
      "type": "string",
      "valueset-uri": "valuesets/vaccine-mah-manf.json"
    },
    "vaccine-medicinal-product": {
      "description": "EU eHealthNetwork: Value Sets for Digital Covid Certificates. version 1.0, 2021-04-16, section 2.3",
      "type": "string",
      "valueset-uri": "valuesets/vaccine-medicinal-product.json"
    },
    "vaccine-prophylaxis": {
      "description": "EU eHealthNetwork: Value Sets for Digital Covid Certificates. version 1.0, 2021-04-16, section 2.2",
      "type": "string",
      "valueset-uri": "valuesets/vaccine-prophylaxis.json"
    }
  },
  "$id": "https://id.uvci.eu/DCC.combined-schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "description": "EU Digital Covid Certificate",
  "oneOf": [
    {
      "required": [
        "ver",
        "nam",
        "dob",
        "v"
      ]
    },
    {
      "required": [
        "ver",
        "nam",
        "dob",
        "t"
      ]
    },
    {
      "required": [
        "ver",
        "nam",
        "dob",
        "r"
      ]
    }
  ],
  "properties": {
    "dob": {
      "description": "Date of Birth of the person addressed in the DCC. ISO 8601 date format restricted to range 1900-2099 or empty",
      "examples": [
        "1979-04-14",
        "1950",
        "1901-08",
        ""
      ],
      "pattern": "^((19|20)\\d\\d(-\\d\\d){0,2}){0,1}$",
      "title": "Date of birth",
      "type": "string"
    },
    "nam": {
      "$ref": "#/$defs/person_name",
      "description": "Surname(s), forename(s) - in that order"
    },
    "r": {
      "description": "Recovery Group",
      "items": {
        "$ref": "#/$defs/recovery_entry"
      },
      "maxItems": 1,
      "minItems": 1,
      "type": "array"
    },
    "t": {
      "description": "Test Group",
      "items": {
        "$ref": "#/$defs/test_entry"
      },
      "maxItems": 1,
      "minItems": 1,
      "type": "array"
    },
    "v": {
      "description": "Vaccination Group",
      "items": {
        "$ref": "#/$defs/vaccination_entry"
      },
      "maxItems": 1,
      "minItems": 1,
      "type": "array"
    },
    "ver": {
      "description": "Version of the schema, according to Semantic versioning (ISO, https://semver.org/ version 2.0.0 or newer)",
      "examples": [
        "1.3.0"
      ],
      "pattern": "^\\d+.\\d+.\\d+$",
      "title": "Schema version",
      "type": "string"
    }
  },
  "title": "EU DCC",
  "type": "object"
}