{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/gematik-health-care-patient-list/latest.json",
  "title": "PatientsRepository",
  "description": "List of all patients used for testing by gematik",
  "x-lintel": {
    "source": "https://www.schemastore.org/gematik-test-patients.json",
    "sourceSha256": "4bda61398bc4f51058cdd57d564f1dfede6651ba64f26c41c92c140f88ba04be",
    "fileMatch": [
      "**/testdata/patient/patients.yml",
      "**/testdata/patient/patients.yaml"
    ],
    "parsers": [
      "yaml"
    ]
  },
  "type": "object",
  "properties": {
    "patients": {
      "type": "object",
      "existingJavaType": "java.util.Map<String, Patient>",
      "additionalProperties": {
        "$ref": "#/$defs/Patient",
        "type": "object"
      }
    }
  },
  "$defs": {
    "Patient": {
      "description": "A patient",
      "type": "object",
      "required": [
        "personData"
      ],
      "properties": {
        "alias": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "uniqueItems": true
        },
        "personData": {
          "type": "object",
          "required": [
            "name",
            "kvnr",
            "insurance"
          ],
          "properties": {
            "name": {
              "type": "object",
              "required": [
                "given",
                "family"
              ],
              "properties": {
                "given": {
                  "type": "string"
                },
                "family": {
                  "type": "string"
                },
                "alt": {
                  "type": "string"
                }
              },
              "additionalProperties": false
            },
            "gender": {
              "enum": [
                "w",
                "m",
                "d",
                "x"
              ]
            },
            "birthDate": {
              "anyOf": [
                {
                  "type": "string",
                  "pattern": "^\\d{4}-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01])$"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "address": {
              "type": "object",
              "properties": {
                "houseNumber": {
                  "type": "string"
                },
                "streetName": {
                  "type": "string"
                },
                "postalCode": {
                  "type": "string"
                },
                "city": {
                  "type": "string"
                },
                "country": {
                  "type": "string"
                }
              },
              "additionalProperties": false
            },
            "deliveryAddress": {
              "type": "object",
              "properties": {
                "houseNumber": {
                  "type": "string"
                },
                "streetName": {
                  "type": "string"
                },
                "postalCode": {
                  "type": "string"
                },
                "city": {
                  "type": "string"
                },
                "country": {
                  "type": "string"
                }
              },
              "additionalProperties": false
            },
            "kvnr": {
              "type": "string"
            },
            "insurance": {
              "type": "string"
            }
          },
          "additionalProperties": false
        },
        "ownerTestsuite": {
          "type": "string"
        },
        "cards": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Card"
          }
        },
        "services": {
          "type": "object",
          "properties": {
            "idp": {
              "type": "object",
              "properties": {
                "sectIdp": {
                  "type": "string"
                }
              }
            },
            "vsdm": {
              "type": "object",
              "properties": {
                "cardUpdate": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "additionalProperties": false
    },
    "Card": {
      "type": "object",
      "required": [
        "iccsn",
        "type"
      ],
      "properties": {
        "iccsn": {
          "type": "string"
        },
        "type": {
          "type": "string"
        },
        "expiryDate": {
          "type": "string",
          "pattern": "^\\d{4}-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01])$"
        }
      },
      "additionalProperties": false
    }
  }
}
