{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://vetdatastandards.com/schemas/v0.1/client.schema.json",
  "title": "Client",
  "description": "Account holder. A person or an organisation. Communication-consent models are out of v0.1 core.",
  "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" },
    "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 },
    "address": { "$ref": "https://vetdatastandards.com/schemas/v0.1/common.schema.json#/$defs/address" },
    "emergencyName": { "type": "string", "minLength": 1, "maxLength": 255 },
    "emergencyPhone": { "type": "string", "minLength": 1, "maxLength": 64 },
    "notes": { "type": "string", "maxLength": 8192 },
    "accountReference": { "type": "string", "minLength": 1, "maxLength": 64 }
  }
}
