{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/taylors/main/json-schema/taylors-patron-schema.json",
  "title": "Koha Patron",
  "description": "A library patron (borrower) record from the Taylor's Library Koha REST API.",
  "type": "object",
  "additionalProperties": false,
  "required": ["patron_id", "category_id", "library_id", "lang"],
  "properties": {
    "patron_id": { "type": "integer", "description": "Internal patron identifier" },
    "cardnumber": { "type": ["string", "null"], "maxLength": 32, "description": "Library assigned user identifier" },
    "category_id": { "type": "string", "maxLength": 10, "description": "Internal identifier for the patron's category" },
    "library_id": { "type": "string", "maxLength": 10, "description": "Internal identifier for the patron's home library" },
    "firstname": { "type": ["string", "null"], "description": "Patron's first name" },
    "surname": { "type": ["string", "null"], "description": "Patron's surname or last name" },
    "preferred_name": { "type": ["string", "null"], "description": "Patron's preferred name" },
    "email": { "type": ["string", "null"], "description": "Primary email address" },
    "phone": { "type": ["string", "null"], "description": "Primary phone number" },
    "mobile": { "type": ["string", "null"], "description": "Mobile phone number" },
    "date_of_birth": { "type": ["string", "null"], "format": "date", "description": "Patron's date of birth" },
    "date_enrolled": { "type": ["string", "null"], "format": "date", "description": "Date the patron was added to Koha" },
    "expiry_date": { "type": ["string", "null"], "format": "date", "description": "Date the patron's card expires" },
    "city": { "type": ["string", "null"], "description": "City or town of primary address" },
    "country": { "type": ["string", "null"], "description": "Country of primary address" },
    "postal_code": { "type": ["string", "null"], "description": "Zip or postal code" },
    "lang": { "type": "string", "maxLength": 25, "description": "Language used to send notices" },
    "checkouts_count": { "type": ["integer", "null"], "description": "Number of checkouts" },
    "overdues_count": { "type": ["integer", "null"], "description": "Number of overdue checkouts" },
    "account_balance": { "type": ["number", "null"], "description": "Balance of the patron's account" },
    "expired": { "type": "boolean", "readOnly": true, "description": "If the patron is expired" },
    "restricted": { "type": "boolean", "readOnly": true, "description": "If any restriction applies to the patron" },
    "updated_on": { "type": ["string", "null"], "format": "date-time", "description": "Last modification date" }
  }
}
