{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://vetdatastandards.com/schemas/v0.1/staff.schema.json",
  "title": "Staff",
  "type": "object",
  "additionalProperties": false,
  "required": ["id", "practiceId", "displayName", "source"],
  "properties": {
    "id": { "$ref": "https://vetdatastandards.com/schemas/v0.1/common.schema.json#/$defs/id" },
    "source": { "$ref": "https://vetdatastandards.com/schemas/v0.1/common.schema.json#/$defs/source" },
    "matchKeys": { "$ref": "https://vetdatastandards.com/schemas/v0.1/common.schema.json#/$defs/matchKeys" },
    "createdAt": { "$ref": "https://vetdatastandards.com/schemas/v0.1/common.schema.json#/$defs/dateTime" },
    "updatedAt": { "$ref": "https://vetdatastandards.com/schemas/v0.1/common.schema.json#/$defs/dateTime" },
    "deletedAt": { "$ref": "https://vetdatastandards.com/schemas/v0.1/common.schema.json#/$defs/dateTime" },
    "active": { "type": "boolean" },
    "extensions": { "$ref": "https://vetdatastandards.com/schemas/v0.1/common.schema.json#/$defs/extensions" },
    "practiceId": { "$ref": "https://vetdatastandards.com/schemas/v0.1/common.schema.json#/$defs/id" },
    "locationId": { "$ref": "https://vetdatastandards.com/schemas/v0.1/common.schema.json#/$defs/id" },
    "displayName": { "type": "string", "minLength": 1, "maxLength": 255 },
    "givenName": { "type": "string", "minLength": 1, "maxLength": 128 },
    "familyName": { "type": "string", "minLength": 1, "maxLength": 128 },
    "email": { "type": "string", "format": "email", "maxLength": 255 },
    "phone": { "type": "string", "minLength": 1, "maxLength": 64 },
    "role": {
      "type": "string",
      "enum": [
        "veterinarian",
        "veterinary_nurse",
        "veterinary_technician",
        "receptionist",
        "practice_manager",
        "other"
      ]
    },
    "roleText": { "$ref": "https://vetdatastandards.com/schemas/v0.1/common.schema.json#/$defs/rawText" },
    "registrationBody": { "type": "string", "minLength": 1, "maxLength": 128 },
    "registrationNumber": { "type": "string", "minLength": 1, "maxLength": 64 }
  },
  "if": {
    "properties": { "role": { "const": "other" } },
    "required": ["role"]
  },
  "then": {
    "required": ["roleText"]
  }
}
