{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://vetdatastandards.com/schemas/v0.1/vaccination.schema.json",
  "title": "Vaccination",
  "type": "object",
  "additionalProperties": false,
  "required": ["id", "practiceId", "patientId", "vaccineName", "administeredAt", "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" },
    "patientId": { "$ref": "https://vetdatastandards.com/schemas/v0.1/common.schema.json#/$defs/id" },
    "consultationId": { "$ref": "https://vetdatastandards.com/schemas/v0.1/common.schema.json#/$defs/id" },
    "appointmentId": { "$ref": "https://vetdatastandards.com/schemas/v0.1/common.schema.json#/$defs/id" },
    "productId": { "$ref": "https://vetdatastandards.com/schemas/v0.1/common.schema.json#/$defs/id" },
    "staffId": { "$ref": "https://vetdatastandards.com/schemas/v0.1/common.schema.json#/$defs/id" },
    "vaccineName": { "type": "string", "minLength": 1, "maxLength": 255 },
    "administeredAt": { "$ref": "https://vetdatastandards.com/schemas/v0.1/common.schema.json#/$defs/dateTime" },
    "lotNumber": { "type": "string", "minLength": 1, "maxLength": 64 },
    "manufacturer": { "type": "string", "minLength": 1, "maxLength": 255 },
    "nextDueDate": { "$ref": "https://vetdatastandards.com/schemas/v0.1/common.schema.json#/$defs/date" },
    "route": { "type": "string", "minLength": 1, "maxLength": 64 },
    "site": { "type": "string", "minLength": 1, "maxLength": 64 },
    "status": {
      "type": "string",
      "enum": ["administered", "historical", "cancelled", "other"]
    },
    "statusRaw": { "$ref": "https://vetdatastandards.com/schemas/v0.1/common.schema.json#/$defs/rawText" }
  },
  "if": {
    "properties": { "status": { "const": "other" } },
    "required": ["status"]
  },
  "then": {
    "required": ["statusRaw"]
  }
}
