{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/propagator-health/json-schema/propagator-health-patient-schema.json",
  "title": "Patient",
  "description": "Patient. `id` is always present. Other properties, including firstName/lastName, are omitted when the PMS does not supply them — never null.",
  "x-generated": "2026-12-02",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/propagator-health-openapi.json#/components/schemas/Patient",
  "type": "object",
  "required": [
    "id"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Patient ID"
    },
    "firstName": {
      "type": "string"
    },
    "lastName": {
      "type": "string"
    },
    "middleName": {
      "type": "string"
    },
    "fullName": {
      "type": "string"
    },
    "title": {
      "type": "string"
    },
    "gender": {
      "type": "string",
      "enum": [
        "male",
        "female",
        "other",
        "unknown"
      ]
    },
    "nhi": {
      "type": "string",
      "description": "NZ National Health Index number"
    },
    "active": {
      "type": "boolean",
      "description": "Whether the record is current; an archived or inactive record is false"
    },
    "status": {
      "type": "string",
      "description": "Where the record stands with the practice, the same words on every target; absent when the practice management system says nothing either way",
      "enum": [
        "active",
        "inactive",
        "archived",
        "deceased"
      ]
    },
    "registrationStatus": {
      "type": "string",
      "description": "How the patient is registered (enrolled) with the practice, the same words on every target; served only where the practice management system records a registration, absent otherwise. A casual or visiting patient is still an active record.",
      "enum": [
        "registered",
        "casual",
        "visitor",
        "not-registered",
        "registered-elsewhere",
        "transferred",
        "deceased"
      ]
    },
    "dateOfBirth": {
      "type": "string",
      "format": "date"
    },
    "email": {
      "type": "string",
      "format": "email"
    },
    "phones": {
      "type": "array",
      "description": "Patient phone numbers (matches PATCH UpdatePatientRequest)",
      "items": {
        "type": "object",
        "required": [
          "type",
          "number"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "mobile",
              "home",
              "work",
              "fax",
              "other"
            ],
            "description": "Phone number type"
          },
          "number": {
            "type": "string",
            "description": "Phone number"
          }
        }
      }
    },
    "address": {
      "type": "object",
      "properties": {
        "street": {
          "type": "string"
        },
        "suburb": {
          "type": "string"
        },
        "city": {
          "type": "string"
        },
        "state": {
          "type": "string"
        },
        "postalCode": {
          "type": "string"
        },
        "country": {
          "type": "string"
        }
      }
    },
    "lastUpdated": {
      "type": "string",
      "format": "date-time"
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    }
  }
}