{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://json.schemastore.org/gematik-test-patients.json",
  "title": "PatientsRepository",
  "description": "List of all patients used for testing by gematik",
  "type": "object",
  "definitions": {
    "Patient": {
      "description": "A patient",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "alias": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "uniqueItems": true
        },
        "personData": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "name": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "given": {
                  "type": "string"
                },
                "family": {
                  "type": "string"
                },
                "alt": {
                  "type": "string"
                }
              },
              "required": ["given", "family"]
            },
            "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",
              "additionalProperties": false,
              "properties": {
                "houseNumber": {
                  "type": "string"
                },
                "streetName": {
                  "type": "string"
                },
                "postalCode": {
                  "type": "string"
                },
                "city": {
                  "type": "string"
                },
                "country": {
                  "type": "string"
                }
              }
            },
            "deliveryAddress": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "houseNumber": {
                  "type": "string"
                },
                "streetName": {
                  "type": "string"
                },
                "postalCode": {
                  "type": "string"
                },
                "city": {
                  "type": "string"
                },
                "country": {
                  "type": "string"
                }
              }
            },
            "kvnr": {
              "type": "string"
            },
            "insurance": {
              "type": "string"
            }
          },
          "required": ["name", "kvnr", "insurance"]
        },
        "ownerTestsuite": {
          "type": "string"
        },
        "cards": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/Card"
          }
        },
        "services": {
          "type": "object",
          "properties": {
            "idp": {
              "type": "object",
              "properties": {
                "sectIdp": {
                  "type": "string"
                }
              }
            },
            "vsdm": {
              "type": "object",
              "properties": {
                "cardUpdate": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "required": ["personData"]
    },
    "Card": {
      "type": "object",
      "additionalProperties": false,
      "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])$"
        }
      },
      "required": ["iccsn", "type"]
    }
  },
  "properties": {
    "patients": {
      "type": "object",
      "existingJavaType": "java.util.Map<String, Patient>",
      "additionalProperties": {
        "$ref": "#/definitions/Patient",
        "type": "object"
      }
    }
  }
}
